import axios from 'axios'
export function getHotKey (callback) {
  axios('/vkey/splcloud/fcgi-bin/gethotkey.fcg', {
    params: {
      '_': '1562292271005',
      g_tk: 5381,
      uin: 0,
      format: 'json',
      inCharset: 'utf-8',
      outCharset: 'utf-8',
      notice: 0,
      platform: 'h5',
      needNewCode: 1
    }
  }).then((response) => {
    callback(response)
  }).catch((error) => {
    callback(error)
  })
}

export function getHotIndex (hotIndex, perpage, page, callback) {
  axios('/vkey/soso/fcgi-bin/search_for_qq_cp', {
    params: {
      '_': '1562295930261',
      g_tk: 5381,
      uin: 0,
      format: 'json',
      inCharset: 'utf-8',
      outCharset: 'utf-8',
      notice: 0,
      platform: 'h5',
      needNewCode: 1,
      w: hotIndex,
      zhidaqu: 1,
      catZhida: 1,
      t: 0,
      flag: 1,
      ie: 'utf-8',
      sem: 1,
      aggr: 0,
      perpage: perpage,
      n: perpage,
      p: page,
      remoteplace: 'txt.mqq.all'
    }
  }).then((response) => {
    callback(response)
  }).catch((error) => {
    callback(error)
  })
}